import { useEffect, useRef } from "react"
import GetComponentFn from "./getComponent"
import { useForceUpdate } from '@/pages/index'
function VisionShow(props:any) {
  let {mapKey, opNode} = props
  let dom = useRef(null)
  let arr = opNode.childrenMap[mapKey].children || []
  console.log(arr)
  const update = useForceUpdate()
  useEffect(()=>{
    opNode.childrenMap[mapKey].forceUpdate = update
    opNode.childrenMap[mapKey].setDom(dom)
  }, [])
  return <div ref={dom} data-my="con">
    {arr.map((item: any) => {
        return <GetComponentFn item={item} key={item.id} />
      })}
  </div>
}

export default VisionShow